/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package factorial;

import javax.swing.JOptionPane;

/**
 *
 * @author JESU
 */
public class Factorial {

    /**
     * @param args the command line arguments
     */
    
    public int factorial (int n) { 
        if (n==0) 
        return 1; 
            else 
            return (n * factorial(n-1));
}
    
    public static void main(String[] args) {
        // TODO code application logic here
        String ns=JOptionPane.showInputDialog("digite n");
        int n=Integer.parseInt(ns);
        Factorial obj=new Factorial();
       JOptionPane.showMessageDialog(null, obj.factorial(n));
        
        
    }
}
